<template>
  <tr>
    <td><input type="checkbox" v-model="goodListObj.checked" /></td>
    <td>{{ goodListObj.name }}</td>
    <td>{{ goodListObj.price }}</td>
    <td>
      <button @click="subBtn">-</button>
      <span>{{ goodListObj.num }}</span>
      <button @click="addBtn">+</button>
    </td>
    <td>{{ goodListObj.price * goodListObj.num }}</td>
    <td><button @click="delBtn">删除</button></td>
  </tr>
</template>

<script>
export default {
  props: {
    goodListObj: Object,
    index: Number,
  },
  // props: ['uname', 'price', 'num', 'checked'],
  methods: {
    subBtn() {
      this.goodListObj.num > 0 ? this.goodListObj.num-- : this.goodListObj.num
    },
    addBtn() {
      this.goodListObj.num++
    },
    delBtn() {
      this.$emit('delBtn', this.index)
    },
  },
}
</script>

<style></style>
